package base.number;


import base.utils.PrintUtils;

/**
 * 与
 * 或
 * 非
 * 运算
 */

public class AndOrNotOperation {

    public static void main(String[] args) {

        lastIsOneAnd();
        lastIsOneOr();
        lastIsOneNot();

    }

    private static void lastIsOneAnd() {
        int tag = 1 ;
        int test = 111 ;

        int result = test & tag ;

        PrintUtils.print("and :tag = " + Integer.toBinaryString(tag) + "; test = " +Integer.toBinaryString(test) +";result = " + Integer.toBinaryString(result));

    }

  private static void lastIsOneOr() {
        int tag = 0 ;
        int test = 111 ;
        int result = test | tag ;

      PrintUtils.print("or tag =" + Integer.toBinaryString(tag) + "; test = " +Integer.toBinaryString(test) +";result = " + Integer.toBinaryString(result));

    }

    private static void lastIsOneNot() {
        int tag = 1;
        int test = 111;

        int result = test ^ tag;

        PrintUtils.print("note : tag = " + Integer.toBinaryString(tag) + ";test = " +Integer.toBinaryString(test) +";result = " +Integer.toBinaryString(result));

    }


}
